package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-11-17
 * Time: 23:19
 */
@Controller
public class UserController4 {

    // Setter 注入

    // 1. 先定义一个需要注入的对象
    private UserService userService;

    // 2.

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }
    public void sayHi() {
        userService.sayHi();
    }
}
